home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-07-22 | 1.8 KB | 81 lines | [TEXT/CWIE] |
- PROGRAM Demo;
- USES
- Types, Errors, Memory, QuickDraw, Fonts, Events, Windows, Menus, TextEdit, Dialogs,
- IconCache, OffscreenUtils, IconButtons, GraySlider;
-
- PROCEDURE InitializeToolbox;
- VAR
- err: OSErr;
-
- BEGIN
- InitGraf(@qd.thePort);
- InitFonts;
- InitWindows;
- InitMenus;
- TEInit;
- InitDialogs(NIL);
- MoreMasters;
- END;
-
- VAR
- w, mainWindow: WindowPtr;
- event: EventRecord;
- done: BOOLEAN;
- box: Rect;
- slider: GraySliderInfo;
- btn1, btn2: IconButtonHandle;
-
- BEGIN
- InitializeToolbox;
-
- mainWindow := GetNewCWindow(128, NIL, WindowPtr(-1));
- SetPort(mainWindow);
-
- SetRect(box, 84, 20, 156, 27);
- InitializeGraySlider(axHoricontal, box, 130, 129, 130, 0, 64, 32, slider);
-
- btn1 := NewIconButton(10, 84, 200, 201, 133);
- btn2 := NewIconButton(50, 84, 131, 132, 128);
-
- done := FALSE;
- REPEAT
- IF WaitNextEvent(everyEvent, event, 30, NIL) THEN
- IF event.what = mouseDown THEN
- CASE FindWindow(event.where, w) OF
- inDrag:
- DragWindow(w, event.where, GetGrayRgn^^.rgnBBox);
-
- inGoAway:
- done := TrackGoAway(w, event.where);
-
- inContent:
- BEGIN
- GlobalToLocal(event.where);
- IF HitGraySlider(slider, event.where) THEN
- IF TrackGraySlider(slider, NIL) THEN
- ;
-
- IF HitIconButton(btn1, event.where) THEN
- IF TrackIconButton(btn1, NIL) THEN
- ;
-
- IF HitIconButton(btn2, event.where) THEN
- IF TrackIconButton(btn2, NIL) THEN
- ;
- END;
- END
- ELSE IF event.what = updateEvt THEN
- BEGIN
- BeginUpdate(WindowPtr(event.message));
- SetRect(box, 10, 10, 74, 74);
- PlotCachedIcon(134, box);
- DrawGraySlider(slider);
- DrawIconButton(btn1);
- DrawIconButton(btn2);
- EndUpdate(WindowPtr(event.message));
- END;
- UNTIL done;
-
- FreeGraySlider(slider);
- DisposeWindow(mainWindow);
- END.